package com.spzx.cart.api;

import com.spzx.cart.api.domain.CartInfo;
import com.spzx.cart.api.factory.RemoteCartFallbackFactory;
import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

@FeignClient(contextId = "remoteCartService",
        value = ServiceNameConstants.CART_SERVICE,
        fallbackFactory = RemoteCartFallbackFactory.class)
public interface RemoteCartService {

    @GetMapping("/getCartCheckedList")
    R<List<CartInfo>> getCartCheckedList(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 修改当前用户的购物车商品实时价格
     *
     * @param source
     * @return
     */
    @GetMapping("/updateCartPrice")
    R updateCartPrice(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 删除已经完成下单的购物车商品
     *
     * @param source
     * @return
     */
    @GetMapping("/deleteCartCheckedList")
    R deleteCartCheckedList(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
